#!/usr/bin/python
# vim:ts=4:sw=4:softtabstop=0:smarttab
# 
#    Copyright (C) 1999-2007  Keith Dart <keith@kdart.com>
#
#    This library is free software; you can redistribute it and/or
#    modify it under the terms of the GNU Lesser General Public
#    License as published by the Free Software Foundation; either
#    version 2.1 of the License, or (at your option) any later version.
#
#    This library is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#    Lesser General Public License for more details.

# Create a fastCGI configuration for lighttpd.
# This is called from the lighthtpd configuration script.


import sys
from pycopia.WWW import serverconfig

config = serverconfig.get_site_config()

ltc = serverconfig.LighttpdConfig()
ltc.add_global(port=config.PORT)
for name, serverlist in config.VHOSTS.items():
    ltc.add_vhost(name, serverlist)
ltc.emit(sys.stdout)
